package com.thoughtworks.khazana;

public abstract class State {

	protected final Player player;
	protected ArmsState armsState;
	

	public State(Player player) {
		this.player = player;
		armsState = new Unarmed(player);
	}

	public abstract void encounter(Player otherPlayer);

	public void encounterThing(String thing) {
		if ("Treasure".equals(thing)) {
			player.winTreasure();
		} else if ("Gun".equals(thing)) {
			armsState = new Armed(player);
		}
	}

	public void encounterUnarmedPlayer(Player otherPlayer) {
		armsState.encounterUnarmedPlayer(otherPlayer);
	}

	public void encounterArmedPlayer(Player otherPlayer) {
		armsState.encounterArmedPlayer(otherPlayer);
	}


}